use "${Input}\comm_dta\vlgtran.dta" 
rename case_id vilid
sort vilid
save ${Output}\Transport, replace

use ${Output}\MainFile
generate str3 vilid=substr(case,1,3)
sort vilid
merge vilid using ${Output}\Transport, nokeep
drop _merge
sort vilid
save ${Output}\MainFile, replace

erase ${Output}\Transport.dta

